CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

SET(common_sources
	BasePacket.cpp
	classes.cpp
	Condition.cpp
	crash.cpp
	CRC16.cpp
	crc32.cpp
	database.cpp
	dbasync.cpp
	dbcore.cpp
	debug.cpp
	emu_opcodes.cpp
	EmuTCPConnection.cpp
	EmuTCPServer.cpp
	EQDB.cpp
	EQDBRes.cpp
	eqemu_exception.cpp
	EQEmuConfig.cpp
	EQEMuError.cpp
	EQPacket.cpp
	EQStream.cpp
	EQStreamFactory.cpp
	EQStreamIdent.cpp
	EQStreamProxy.cpp
	eqtime.cpp
	extprofile.cpp
	faction.cpp
	guild_base.cpp
	guilds.cpp
	ipc_mutex.cpp
	Item.cpp
	logsys.cpp
	logsys_eqemu.cpp
	md5.cpp
	memory_mapped_file.cpp
	misc.cpp
	MiscFunctions.cpp
	moremath.cpp
	Mutex.cpp
	opcode_map.cpp
	opcodemgr.cpp
	packet_dump.cpp
	packet_dump_file.cpp
	packet_functions.cpp
	perl_EQDB.cpp
	perl_EQDBRes.cpp
	ProcLauncher.cpp
	ptimer.cpp
	races.cpp
	rdtsc.cpp
	rulesys.cpp
	serverinfo.cpp
	shareddb.cpp
	spdat.cpp
    StringUtil.cpp
	StructStrategy.cpp
	TCPConnection.cpp
	TCPServer.cpp
	timeoutmgr.cpp
	timer.cpp
	unix.cpp
	worldconn.cpp
	XMLParser.cpp
	platform.cpp
	patches/Client62.cpp
	patches/patches.cpp
	patches/SoD.cpp
	patches/SoF.cpp
	patches/RoF.cpp
	patches/Titanium.cpp
	patches/Underfoot.cpp
	SocketLib/Base64.cpp
	SocketLib/File.cpp
	SocketLib/HttpdCookies.cpp
	SocketLib/HttpdForm.cpp
	SocketLib/HttpdSocket.cpp
	SocketLib/HTTPSocket.cpp
	SocketLib/MemFile.cpp
	SocketLib/Mime.cpp
	SocketLib/Parse.cpp
	SocketLib/socket_include.cpp
	SocketLib/Utility.cpp
	StackWalker/StackWalker.cpp
	tinyxml/tinystr.cpp
	tinyxml/tinyxml.cpp
	tinyxml/tinyxmlerror.cpp
	tinyxml/tinyxmlparser.cpp
)

SET(common_headers
	BasePacket.h
	base_data.h
	bodytypes.h
	breakdowns.h
	classes.h
	Condition.h
	crash.h
	CRC16.h
	crc32.h
	database.h
	dbasync.h
	dbcore.h
	debug.h
	deity.h
	emu_opcodes.h
	emu_oplist.h
	EmuTCPConnection.h
	EmuTCPServer.h
	eq_constants.h
	eq_packet_structs.h
	EQDB.h
	EQDBRes.h
	eqemu_exception.h
	EQEmuConfig.h
	EQEmuConfig_elements.h
	EQEMuError.h
	EQPacket.h
	EQStream.h
	EQStreamFactory.h
	EQStreamIdent.h
	EQStreamIntf.h
	EQStreamLocator.h
	EQStreamProxy.h
	EQStreamType.h
	eqtime.h
	errmsg.h
	extprofile.h
	faction.h
	features.h
	fixed_memory_hash_set.h
	fixed_memory_variable_hash_set.h
	guild_base.h
	guilds.h
	ipc_mutex.h
	Item.h
	item_fieldlist.h
	item_struct.h
	languages.h
	linked_list.h
	logsys.h
	logtypes.h
	loottable.h
	mail_oplist.h
	md5.h
	memory_mapped_file.h
	misc.h
	MiscFunctions.h
	moremath.h
	Mutex.h
	op_codes.h
	opcode_dispatch.h
	opcodemgr.h
	packet_dump.h
	packet_dump_file.h
	packet_functions.h
	ProcLauncher.h
	profiler.h
	ptimer.h
	queue.h
	races.h
	rdtsc.h
	rulesys.h
	ruletypes.h
	seperator.h
	serverinfo.h
	servertalk.h
	shareddb.h
	skills.h
	spdat.h
    StringUtil.h
	StructStrategy.h
	TCPBasicServer.h
	TCPConnection.h
	TCPServer.h
	timeoutmgr.h
	timer.h
	types.h
	unix.h
	useperl.h
	version.h
	worldconn.h
	XMLParser.h
	ZoneNumbers.h
	platform.h
	patches/Client62.h
	patches/Client62_itemfields.h
	patches/Client62_ops.h
	patches/Client62_structs.h
	patches/patches.h
	patches/SoD.h
	patches/SoD_itemfields.h
	patches/SoD_ops.h
	patches/SoD_structs.h
	patches/SoF.h
	patches/SoF_itemfields.h
	patches/SoF_opcode_list.h
	patches/SoF_ops.h
	patches/SoF_structs.h
	patches/SSDeclare.h
	patches/SSDefine.h
	patches/SSRegister.h
	patches/RoF.h
	patches/RoF_itemfields.h
	patches/RoF_ops.h
	patches/RoF_structs.h
	patches/Titanium.h
	patches/Titanium_itemfields.h
	patches/Titanium_ops.h
	patches/Titanium_structs.h
	patches/Underfoot.h
	patches/Underfoot_itemfields.h
	patches/Underfoot_ops.h
	patches/Underfoot_structs.h
	SocketLib/Base64.h
	SocketLib/File.h
	SocketLib/HttpdCookies.h
	SocketLib/HttpdForm.h
	SocketLib/HttpdSocket.h
	SocketLib/HTTPSocket.h
	SocketLib/IFile.h
	SocketLib/MemFile.h
	SocketLib/Mime.h
	SocketLib/Parse.h
	SocketLib/socket_include.h
	SocketLib/Utility.h
	StackWalker/StackWalker.h
	tinyxml/tinystr.h
	tinyxml/tinyxml.h
)

SOURCE_GROUP(Patches FILES
	patches/Client62.h
	patches/Client62_itemfields.h
	patches/Client62_ops.h
	patches/Client62_structs.h
	patches/patches.h
	patches/SoD.h
	patches/SoD_itemfields.h
	patches/SoD_ops.h
	patches/SoD_structs.h
	patches/SoF.h
	patches/SoF_itemfields.h
	patches/SoF_opcode_list.h
	patches/SoF_ops.h
	patches/SoF_structs.h
	patches/SSDeclare.h
	patches/SSDefine.h
	patches/SSRegister.h
	patches/RoF.h
	patches/RoF_itemfields.h
	patches/RoF_ops.h
	patches/RoF_structs.h
	patches/Titanium.h
	patches/Titanium_itemfields.h
	patches/Titanium_ops.h
	patches/Titanium_structs.h
	patches/Underfoot.h
	patches/Underfoot_itemfields.h
	patches/Underfoot_ops.h
	patches/Underfoot_structs.h
	patches/Client62.cpp
	patches/patches.cpp
	patches/SoD.cpp
	patches/SoF.cpp
	patches/RoF.cpp
	patches/Titanium.cpp
	patches/Underfoot.cpp
)

SOURCE_GROUP(SocketLib FILES
	SocketLib/Base64.h
	SocketLib/File.h
	SocketLib/HttpdCookies.h
	SocketLib/HttpdForm.h
	SocketLib/HttpdSocket.h
	SocketLib/HTTPSocket.h
	SocketLib/IFile.h
	SocketLib/MemFile.h
	SocketLib/Mime.h
	SocketLib/Parse.h
	SocketLib/socket_include.h
	SocketLib/Utility.h
	SocketLib/Base64.cpp
	SocketLib/File.cpp
	SocketLib/HttpdCookies.cpp
	SocketLib/HttpdForm.cpp
	SocketLib/HttpdSocket.cpp
	SocketLib/HTTPSocket.cpp
	SocketLib/MemFile.cpp
	SocketLib/Mime.cpp
	SocketLib/Parse.cpp
	SocketLib/socket_include.cpp
	SocketLib/Utility.cpp
)

SOURCE_GROUP(StackWalker FILES
	StackWalker/StackWalker.h
	StackWalker/StackWalker.cpp
)

SOURCE_GROUP(TinyXML FILES
	tinyxml/tinystr.h
	tinyxml/tinyxml.h
	tinyxml/tinystr.cpp
	tinyxml/tinyxml.cpp
	tinyxml/tinyxmlerror.cpp
	tinyxml/tinyxmlparser.cpp
)

INCLUDE_DIRECTORIES(Patches SocketLib StackWalker TinyXML)

ADD_LIBRARY(Common ${common_sources} ${common_headers})

IF(UNIX)
	ADD_DEFINITIONS(-fPIC)
	SET_SOURCE_FILES_PROPERTIES("patches/SoD.cpp" "patches/SoF.cpp" "patches/RoF.cpp" "patches/Underfoot.cpp" PROPERTIES COMPILE_FLAGS -O0)
ENDIF(UNIX)

SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/Bin)
